package bman.tools.net;

import static org.junit.Assert.*;

import java.util.logging.Logger;

import org.junit.Test;



public class RadioTest
{
	Logger log = Logger.getLogger(this.getClass().getName());
	
	static String msg1 =  "Test Message";
	static String msg2 =  "Another Test Message";
	
	
	@Test
	public void testRadio() 
	{
		try
		{
			
			DummyReceiver tr = new DummyReceiver();
			Radio r1 = new Radio(tr,777);
			r1.send("127.0.0.1:777", msg1.getBytes());
			Thread.sleep(100);
			
			r1.send("127.0.0.1:777", msg2.getBytes());
			Thread.sleep(100);
			
			assertFalse(tr.errorMsg,tr.error);
		}
		catch(Exception e)
		{
			e.printStackTrace();
			fail();
		}
	}
}

